package com.hzqiuxm.tdddemo001.jinggame2;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Copyright © 2020年 tdd-demo-001. All rights reserved.
 *
 * @author 临江仙 hzqiuxm@163.com
 * 井字游戏服务类
 * @date 2020/8/18 17:38
 */
@Service
public class TicTacService {
    @Autowired
    private TicTacRepository ticTacRepository;

    /**
     * 保存该步的游戏信息
     * @param ticTacToeBean
     */
    public void saveMove(TicTacToeBean ticTacToeBean) {

        ticTacRepository.save(ticTacToeBean);
    }

    /**
     * 清空游戏记录
     */
    public void clearAllTicTacs() {

        ticTacRepository.deleteAll();
    }


    /**
     * 获得游戏备份记录
     */
    public List<TicTacToeBean> getAllTicTacs() {

        return ticTacRepository.findAll();
    }
}
